/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.power.powercash;

import com.power.utils.SearchList;

/**
 *
 * @author f6036477
 */
public class StringSearchable extends SearchList
{

  private String name;

  private static int def_name_inc = 0;


  public StringSearchable(String name)
  {
    if(name == null)
      name = "default" + def_name_inc++;
    this.name = name;
  }


  public String getName()
  {
    return name;
  }

  public void setName(String name)
  {
    if(name == null)
      name = "default" + def_name_inc++;
    this.name = name;
  }

  @Override
  public int hashCode()
  {
    return name.hashCode();
  }

  @Override
  public boolean equals(Object o)
  {
    if(o == null) return false;
    if(o instanceof StringSearchable)
      return ((StringSearchable)o).hashCode() == this.hashCode();

    return false;
  }

}
